package com.gao.mq.handler;

import com.gao.mq.domain.MessageInfo;
import com.gao.mq.service.MessageConsumerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class MessageHandlerBase implements IMessageHandler {

    private static final Logger logger = LoggerFactory.getLogger(MessageConsumerService.class);

    /**
     * 消息处理
     * @param messageInfo
     */
    @Override
    public void doHandle(MessageInfo messageInfo) {
        if (handler(messageInfo)) {
            logger.info("消息发送成功!");
        }
    }

    /**
     * 统一处理的handler接口
     * @param messageInfo
     * @return
     */
    public abstract boolean handler(MessageInfo messageInfo);
}
